home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_052 / tek4010 / filename.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  60 lines

  1. /****************************************************
  2.  * vt100 emulator
  3.  *
  4.  *         Oct 86 TAW - removed Busy polling, & other bug fixes
  5.  *           860823 DBW - Integrated and rewrote lots of code
  6.  *      v2.0 860809 DBW - Major rewrite
  7.  *      v1.1 860720 DBW - Switches, 80 cols, colors, bug fixes
  8.  *      v1.0 860712 DBW - First version released
  9.  *
  10.  ****************************************************/
  11.  
  12. #include "vt100.h"
  13.  
  14. /*************************************************
  15. *  function to get file name
  16. *************************************************/
  17. void filename(name)
  18. char name[];
  19.     {
  20.     char c;
  21.     ULONG class;
  22.     unsigned int code;
  23.     int keepgoing,i;
  24.     keepgoing = TRUE;
  25.     i=0;
  26.     while (keepgoing) {
  27.         cursoron();
  28.         Wait ( 1<< mywindow->UserPort->mp_SigBit);
  29.         while( NewMessage=(struct IntuiMessage *)GetMsg(mywindow->UserPort)){
  30.             class = NewMessage->Class;
  31.             code = NewMessage->Code;
  32.             ReplyMsg( NewMessage );
  33.             cursoroff();
  34.             if (class==RAWKEY) {
  35.                 c = toasc(code,1);
  36.                 if (c == 0) ;
  37.                 else if (c == 13) {
  38.                      name[i] = 0;
  39.                      keepgoing = FALSE;
  40.                      }
  41.                 else if (c == 8 || c == 127) {
  42.                    if (i != 0) {
  43.                       i--;
  44.                       emit(8);
  45.                       emit(32);
  46.                       emit(8);
  47.                       }
  48.                    }
  49.                 else {
  50.                   emit(c);
  51.               name[i++] = c;
  52.                   }
  53.  
  54.             } /* end of class == */
  55.           } /* end of GetMsg */
  56.     }   /* end of keepgoing loop */
  57.     emit(13);
  58.     emit(10);
  59.     } /* end of function */
  60.